//
//  GSApplication.cpp
//  GSEngine
//
//  Created by Гукун Александр on 1/22/14.
//  Copyright (c) 2014 SNK. All rights reserved.
//

#include "GSApplication.h"

namespace GSEngine
{
    GSApplication* GSApplication::m_instance = NULL;
    // only for iOS
    GSPlatform* CreatePlatformIOS(int argc, char* argv[]);

    GSApplication::GSApplication(int argc, char* argv[], const GSAppDescriptor& desc) : m_platform(NULL)
    {
        m_instance = this;
        m_platform = CreatePlatformIOS(argc, argv);
        m_platform->createWindow(desc.m_width, desc.m_height);
        std::cout << "Application created\n";
    }

    GSApplication::~GSApplication()
    {
        std::cout << "Application destroyed\n";
    }
    
    GSPlatform* GSApplication::getPlatform()
    {
        return m_platform;
    }
    
    GSRenderSystem* GSApplication::getRenderSystem()
    {
        return getPlatform()->getRenderSystem();
    }
    
    void GSApplication::start()
    {
        m_platform->startLoop();
    }
    

}
